/*
  作者: 劳兆城
  描述: 创建 Control 的方法
*/

import Control from 'ol/control'
import ControlScaleLine from 'ol/control/scaleline'

// 创建 ol.control
export const createControl = (options) => Control.defaults(options)

// 创建 ol.control.scaleline
export const createControlScaleLine = (options) => new ControlScaleLine(options)

// 创建比例尺代码
export const createScaleLine = (options = {}, otherControl = []) => {
  return createControl({
    attribution: false,
    zoom: false,
    ...options
  }).extend([
    createControlScaleLine(),
    ...otherControl
  ])
}
